Skip to content

SD-2281 - fix: page number on footer not properly aligned#2725

Open
chittolinag wants to merge 2 commits intomainfrom
gabriel/sd-2281-bug-floating-footer-page-number-textbox-overlaps-footer-text
Open

SD-2281 - fix: page number on footer not properly aligned#2725
chittolinag wants to merge 2 commits intomainfrom
gabriel/sd-2281-bug-floating-footer-page-number-textbox-overlaps-footer-text

Conversation

@chittolinag
Copy link
Copy Markdown
Contributor

@chittolinag chittolinag commented Apr 6, 2026

Issue

Floating page-number text boxes overlapped footer text because page-relative anchors were normalized against the bottom margin instead of the footer distance, with the incorrect origin cascading into DomPainter and cache reuse.

Proposed solution

Thread the footer distance through header/footer constraints, normalize footer anchors using that distance (with a bottom-margin fallback), update cache hashing to include the new geometry, and teach DomPainter to convert page-relative footer anchors using the same origin so floating page numbers sit beneath footer content.

@linear
Copy link
Copy Markdown

linear bot commented Apr 6, 2026

@chittolinag chittolinag requested a review from harbournick April 6, 2026 23:01
@chittolinag chittolinag marked this pull request as ready for review April 6, 2026 23:01
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f92d0f8016

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +55 to +56
if (typeof footerDistance === 'number' && Number.isFinite(footerDistance)) {
return pageHeight - Math.max(0, footerDistance);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Clamp footer-origin math before normalizing footer anchors

The new footer-distance branch can produce a negative band origin when margins.footer > pageHeight (computeFooterBandOrigin returns pageHeight - footerDistance without clamping). In that case normalizeFragmentsForRegion writes fragment.y using a negative origin, but DomPainter’s getDecorationAnchorPageOriginY clamps the same expression to >= 0, so the two stages disagree and page-relative footer media render shifted by the clamp delta. This creates deterministic misplacement for malformed-but-parseable section margins and is introduced by this footer-distance path.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants